# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Mirror.V1.Model.Notification do
  @moduledoc """
  A notification delivered by the API.

  ## Attributes

  *   `collection` (*type:* `String.t`, *default:* `nil`) - The collection that generated the notification.
  *   `itemId` (*type:* `String.t`, *default:* `nil`) - The ID of the item that generated the notification.
  *   `operation` (*type:* `String.t`, *default:* `nil`) - The type of operation that generated the notification.
  *   `userActions` (*type:* `list(GoogleApi.Mirror.V1.Model.UserAction.t)`, *default:* `nil`) - A list of actions taken by the user that triggered the notification.
  *   `userToken` (*type:* `String.t`, *default:* `nil`) - The user token provided by the service when it subscribed for notifications.
  *   `verifyToken` (*type:* `String.t`, *default:* `nil`) - The secret verify token provided by the service when it subscribed for notifications.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :collection => String.t(),
          :itemId => String.t(),
          :operation => String.t(),
          :userActions => list(GoogleApi.Mirror.V1.Model.UserAction.t()),
          :userToken => String.t(),
          :verifyToken => String.t()
        }

  field(:collection)
  field(:itemId)
  field(:operation)
  field(:userActions, as: GoogleApi.Mirror.V1.Model.UserAction, type: :list)
  field(:userToken)
  field(:verifyToken)
end

defimpl Poison.Decoder, for: GoogleApi.Mirror.V1.Model.Notification do
  def decode(value, options) do
    GoogleApi.Mirror.V1.Model.Notification.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Mirror.V1.Model.Notification do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
